package models

import "time"

type SocialPlatform string

const (
	Github SocialPlatform = "github"
	Gitee  SocialPlatform = "gitee"
	Weibo  SocialPlatform = "weibo"
)

type Profile struct {
	UID      uint64 `gorm:"primaryKey;comment:关联用户ID"`
	Nickname string `gorm:"type:varchar(30);not null;index;comment:显示名称"`
	Avatar   string `gorm:"type:varchar(200);comment:头像URL"`
	Email    string `gorm:"type:varchar(100);uniqueIndex;comment:电子邮箱"`

	Weibo  string `gorm:"type:varchar(100);default:null;comment:微博账号"`
	Github string `gorm:"type:varchar(50);default:null;comment:Github用户名"`
	Gitee  string `gorm:"type:varchar(50);default:null;comment:Gitee用户名"`
	QQ     string `gorm:"type:varchar(20);default:null;comment:QQ号"`
	Wechat string `gorm:"type:varchar(50);default:null;comment:微信账号"`

	CreatedAt time.Time `gorm:"autoCreateTime;comment:创建时间"`
	UpdatedAt time.Time `gorm:"autoUpdateTime;comment:更新时间"`

	User User `gorm:"foreignKey:UID;references:ID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
}

func (Profile) TableName() string {
	return "profiles"
}
